// commons/diy/qrcode/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    qrcode_active: {
      type: String,
      value: '',
    },
    qrcode: {
      type: String,
      value: '',
    }
  },

  ready:function (){
    this.setData({
      __wxapp_img: wx.getStorageSync('wxapp_img')
    })
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    goodsQrcodeClose:function () {
      this.setData({
        qrcode_active: "",
        no_scroll: !1
      });
    },
    saveGoodsQrcode: function() {
      var t = this;
      wx.saveImageToPhotosAlbum ? (wx.showLoading({
        title: "正在保存图片",
        mask: !1
      }), wx.downloadFile({
        url: t.data.qrcode,
        success: function(t) {
          wx.showLoading({
            title: "正在保存图片",
            mask: !1
          }), wx.saveImageToPhotosAlbum({
            filePath: t.tempFilePath,
            success: function() {
              wx.showModal({
                title: "提示",
                content: "商品海报保存成功",
                showCancel: !1
              });
            },
            fail: function(t) {
              wx.showModal({
                title: "图片保存失败",
                content: t.errMsg,
                showCancel: !1
              });
            },
            complete: function(t) {
              wx.hideLoading();
            }
          });
        },
        fail: function(a) {
          wx.showModal({
            title: "图片下载失败",
            content: a.errMsg + ";" + t.data.goods_qrcode,
            showCancel: !1
          });
        },
        complete: function(t) {
          wx.hideLoading();
        }
      })) : wx.showModal({
        title: "提示",
        content: "当前版本过低，无法使用该功能，请升级到最新版本后重试。",
        showCancel: !1
      });
    },
  }
})
